#include <stdio.h>

int getOctal(int i, int divide, int bit)
{
	if (divide < 8) {
		return i + divide * bit;
	}
	int new = divide % 8;
	i =  bit * new + i;
	bit = bit * 10;
	getOctal(i, divide/8, bit);
}


int main(void){
	int num;
	printf("Enter a 3-digit 32767 number: ");
	scanf("%d", &num);
	int reverseOctal = getOctal(0, num, 1);
	printf("In ocatal, your number is : %5.5d\n", reverseOctal);
}
